-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add blas/base/drotmg
#9724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: passed
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: missing_dependencies
- task: lint_c_examples
status: missing_dependencies
- task: lint_c_benchmarks
status: missing_dependencies
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
Planeshifter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some initial comments.
| // MODULES // | ||
|
|
||
| var abs = require( '@stdlib/math/base/special/abs' ); | ||
| var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a double-precision function (drotmg), so we should use is-nan instead of is-nanf. The f variant is for single-precision floats.
| var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); | |
| var isnan = require( '@stdlib/math/base/assert/is-nan' ); |
And then update the usage on line 69 to use isnan instead of isnanf.
| if ( ad1 > ad2 ) { | ||
| h21 = -y1 / x1; | ||
| h12 = p2 / p1; | ||
| u = 1 - ( h12 * h21 ); | ||
| if ( u > 0.0 ) { | ||
| flag = 0.0; | ||
| d1 = d1 / u; | ||
| d2 = d2 / u; | ||
| x1 = x1 * u; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude Code tells me that this is missing handling for the u <= 0 edge case in this branch and that the Fortran reference implementation (lines 113-126) handles this by setting flag = -1, zeroing out all h values, and zeroing d1, d2, x1. Can you please cross-check the JS implementation against the Fortran code?
| if ( ad1 > ad2 ) { | ||
| h21 = -y1 / x1; | ||
| h12 = p2 / p1; | ||
| u = 1.0 - ( h12 * h21 ); | ||
| if ( u > 0.0 ) { | ||
| flag = 0.0; | ||
| d1 = d1 / u; | ||
| d2 = d2 / u; | ||
| x1 = x1 * u; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as in the JavaScript implementation for whether handling for the u <= 0 edge case is missing.
| #ifndef STDLIB_BLAS_EXT_BASE_DROTMG_H | ||
| #define STDLIB_BLAS_EXT_BASE_DROTMG_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The include guard uses STDLIB_BLAS_EXT_BASE_DROTMG_H but this package is in blas/base/ not blas/ext/base/. Should be STDLIB_BLAS_BASE_DROTMG_H to match other packages like drotm.
| #ifndef STDLIB_BLAS_EXT_BASE_DROTMG_H | |
| #define STDLIB_BLAS_EXT_BASE_DROTMG_H | |
| #ifndef STDLIB_BLAS_BASE_DROTMG_H | |
| #define STDLIB_BLAS_BASE_DROTMG_H |
Also update line 48 to match.
| #ifndef STDLIB_BLAS_EXT_BASE_DROTMG_CBLAS_H | ||
| #define STDLIB_BLAS_EXT_BASE_DROTMG_CBLAS_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue - should use STDLIB_BLAS_BASE_DROTMG_CBLAS_H (no EXT).
| #ifndef STDLIB_BLAS_EXT_BASE_DROTMG_CBLAS_H | |
| #define STDLIB_BLAS_EXT_BASE_DROTMG_CBLAS_H | |
| #ifndef STDLIB_BLAS_BASE_DROTMG_CBLAS_H | |
| #define STDLIB_BLAS_BASE_DROTMG_CBLAS_H |
Also update line 43 to match.
| #ifndef STDLIB_BLAS_EXT_BASE_DROTMG_FORTRAN_H | ||
| #define STDLIB_BLAS_EXT_BASE_DROTMG_FORTRAN_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue - should use STDLIB_BLAS_BASE_DROTMG_FORTRAN_H (no EXT).
| #ifndef STDLIB_BLAS_EXT_BASE_DROTMG_FORTRAN_H | |
| #define STDLIB_BLAS_EXT_BASE_DROTMG_FORTRAN_H | |
| #ifndef STDLIB_BLAS_BASE_DROTMG_FORTRAN_H | |
| #define STDLIB_BLAS_BASE_DROTMG_FORTRAN_H |
Also update line 41 to match.
| // TypeScript Version: 4.1 | ||
|
|
||
| /** | ||
| * Inteface describing `drotmg`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo: "Inteface" should be "Interface".
| * Inteface describing `drotmg`. | |
| * Interface describing `drotmg`. |
| /** | ||
| * Constructs the parameters for a modified Givens plane rotation. | ||
| * | ||
| * @param d1 - scaling factor for the first vector component | ||
| * @param d2 - scaling factor for the second vector component | ||
| * @param x1 - first component of the first vector | ||
| * @param y1 - first component of the second vector | ||
| * @param out - output array | ||
| * @param stride - index increment | ||
| * @param offset - starting index | ||
| * @returns - output array containing the rotation parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc for this declaration includes parameters (out, stride, offset) that don't apply to the main function signature - those only apply to the assign method. The main signature is just ( d1, d2, x1, y1 ).
Should be:
/**
* Constructs the parameters for a modified Givens plane rotation.
*
* @param d1 - scaling factor for the first vector component
* @param d2 - scaling factor for the second vector component
* @param x1 - first component of the first vector
* @param y1 - first component of the second vector
* @returns - output array containing the rotation parameters
*
* @example| var tmp = tryRequire(join(__dirname, './native.js')); | ||
| if (isError(tmp)) { | ||
| drotmg = main; | ||
| } else { | ||
| drotmg = tmp; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing spaces inside parentheses - stdlib style requires spaces inside function calls. Compare with drotm/lib/index.js:
| var tmp = tryRequire(join(__dirname, './native.js')); | |
| if (isError(tmp)) { | |
| drotmg = main; | |
| } else { | |
| drotmg = tmp; | |
| } | |
| var tmp = tryRequire( join( __dirname, './native.js' ) ); | |
| if ( isError( tmp ) ) { | |
| drotmg = main; | |
| } else { | |
| drotmg = tmp; | |
| } |
Progresses #2039.
Description
This pull request:
@stdlib/blas/base/drotmg@stdlib/blas/base/drotmg@stdlib/blas/base/drotmgRelated Issues
This pull request has the following related issues:
Questions
No.
Other
drotmgmain and assign function in C with 6 and 7 arguments respectivelydrotmg.fcode by taking reference from LAPACK LINKChecklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers